<template>
	<view class="container">
		<view class="content">
			<rich-text :nodes="repairRichText(value)"></rich-text>
		</view>
	</view>
</template>

<script lang="ts" setup>
	import { ref } from 'vue';
	import { onLoad } from '@dcloudio/uni-app';
	import { repairRichText } from '@/utils';
	import { getAgreement } from './service';
	
	// 页面标题
	const pageTitle = ref('');
	// 协议内容
	const value = ref<string>('');
	
	onLoad(({ type, title }) => {
		pageTitle.value = title;
		uni.setNavigationBarTitle({ title });
		getAgreement(type).then(res => {
			if (res.code === 200 && res.data) {
				value.value = res.data.content;
			}
		});
	});
</script>

<style lang="scss" scoped>
.container {
	background-color: #fff;
	.content {
		padding: 24rpx;
	}
}
</style>
